import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class C1_12_3 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        ArrayList<String> list = new ArrayList<>();
        int n = Integer.parseInt(br.readLine());
        int sum = 0;
        for(int i = 0;i<n;i++){
            String[] form = br.readLine().split(" ");
            Double f = Double.parseDouble(form[1]);
            if(f>=37.5&&form[2].equals("1")){
                list.add(form[0]);
                sum++;
            }
        }
        for (String person : list) {
            System.out.println(person);  
        }
        System.out.println(sum);
    }
}
